package com.myapp.imp.loading.logical;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import com.myapp.Logical.interfaces.ILogical;
import com.myapp.data.beans.RoleBean;
import com.myapp.data.global.Instances;
import com.myapp.db.dao.manual.RoleDao;
import com.myapp.db.entity.RoleEntity;
import com.myapp.imp.loading.msg.CG_Loading_RoleMsg;
import com.myapp.imp.loading.msg.GC_Loading_RoleMsg;
import com.myapp.msg.base.BaseMsg;
import com.myapp.user.UserBean;

/**
 * 文件名：CG_Loading_RoleLogical.java
 * <p>
 * 功能：读取用户信息，消息名：CG_Loading_Role,权限：AUTHORIZE
 * <p>
 * 版本：1.0.0
 * <p>
 * 作者：Builderd by AppTools
 * <p>
 */
public class CG_Loading_RoleLogical implements ILogical {

	@Override
	public List<BaseMsg> doLogical(UserBean userBean, BaseMsg msg)
			throws IOException {
		List<BaseMsg> back = new ArrayList<BaseMsg>();
		//读取用户信息
		if (msg instanceof CG_Loading_RoleMsg) {
			
			RoleDao dao = (RoleDao) Instances.getDBConfigContainer().getDBConfigBeanByTableName("role").getDao();
			try {
				// RoleEntity roleEntity = dao.getUserByUserid(12345);
				// RoleBean roleBean = new RoleBean();
				// roleBean.setChargecount(roleEntity.getChargecount());
				// roleBean.setExp(roleEntity.getExp());
				// roleBean.setExploit(roleEntity.getExploit());
				// roleBean.setGold(roleEntity.getGold());
				// roleBean.setId(roleEntity.getId());
				// roleBean.setLastUpdateTime(roleEntity.getLastUpdateTime());
				// roleBean.setLv(roleEntity.getLv());
				// roleBean.setMapid(roleEntity.getMapid());
				// roleBean.setName(roleEntity.getName());
				// roleBean.setSilver(roleEntity.getSilver());
				// roleBean.setTotalmoeny(roleEntity.getTotalmoeny());
				// roleBean.setUserid(roleEntity.getUserid());
				// roleBean.setViplv(roleEntity.getViplv());
				// roleBean.setWaveid(roleEntity.getWaveid());
				// roleBean.setWrit(roleEntity.getWrit());
				//
				// // 消息反馈
				// GC_Loading_RoleMsg loadingRoleMsg = new GC_Loading_RoleMsg();
				// loadingRoleMsg.setRoleBean(roleBean);
				// back.add(loadingRoleMsg);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}	
		return back;
	}
}
